#include<bits/stdc++.h>
using namespace std;

const int N=220;
int a[N];
int vis[N];

struct node {
	int floor;
	int d;
};

int main()
{
	int t,A,B;
	cin>>t>>A>>B;
	for(int i=1; i<=t; i++) {
		cin>>a[i];
	}
	queue<node> q;
	q.push((node){A,0});
	vis[A]=1;
	node now;
	while(!q.empty()) {
		now=q.front();
		q.pop();
		if(now.floor==B) {
			break;
		}
		for(int i=-1; i<=1; i+=2) {
			int dist=now.floor+i*a[now.floor];
			if(dist>=1&&dist<=t&&vis[dist]==0) {
				vis[dist]=1;
				q.push((node) {
					dist,now.d+1
				});
			}
		}
	}
	if(now.floor==B) {
		cout<<now.d<<endl;
	} else {
		cout<<-1<<endl;
	}
	return 0;
}
